package util;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class VatUtil {
//    @Before("execution(* service.UserService.login(..))")
//    public void show(){
//        System.out.println("展示滑块验证框");
//    }
//
//    @AfterReturning("execution(* service.UserService.login(..))")
//    public void close(){
//        System.out.println("关闭滑块验证框");
//    }
//
//    @AfterThrowing("execution(* service.UserService.login(..))")
//    public void exception(){
//        System.out.println("滑块验证异常");
//    }

    @Around("execution(* service.UserService.login(..))")
    public void val(ProceedingJoinPoint pjb){
        System.out.println("展示滑块验证框");
        try {
            // 调用目标方法
            pjb.proceed();
        } catch (Throwable e) {
            System.out.println("滑块验证异常: ");
            e.printStackTrace();
        }
        System.out.println("关闭滑块验证框");
    }

}
